/*****************************************************************
 M3D Engine v0.1

 File: myd_light.cpp
 Created: 13/12/09
*****************************************************************/

#include "myd_light.h"

using namespace myd;

Light::Light(IDirect3DDevice9* device)
{
	this->wn_device = device;
}

Light::~Light(void)
{
}

void Light::initLight()
{
	ZeroMemory(&wn_light, sizeof(wn_light));
	wn_light.Position	= D3DXVECTOR3(0.0f, 0.0f, 0.0f);
    wn_light.Type		= D3DLIGHT_DIRECTIONAL;
	wn_light.Ambient	= D3DXCOLOR(0.0f, 0.0f, 0.0f, 0.0f);
    wn_light.Diffuse	= D3DXCOLOR(0.5f, 0.5f, 0.5f, 0.5f);
    wn_light.Direction	= D3DXVECTOR3(0.0f, -10.0f, 0.0f);

    wn_device->SetLight(0, &wn_light);
    wn_device->LightEnable(0, TRUE);

	ZeroMemory(&wn_material, sizeof(D3DMATERIAL9));
    wn_material.Ambient		= D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
    wn_material.Diffuse		= D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	wn_material.Specular	= D3DXCOLOR(2.0f, 2.0f, 2.0f, 2.0f);

    wn_device->SetMaterial(&wn_material);
}
